//
//  TwoViewController.m
//  6-1
//
//  Created by mac on 16-6-1.
//  Copyright (c) 2016年 ztt. All rights reserved.
//

#import "TwoViewController.h"

@interface TwoViewController ()

@end

@implementation TwoViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"第二个view";
    self.view.backgroundColor = [UIColor brownColor];
    UIButton *bn = [UIButton buttonWithType:UIButtonTypeSystem];
    [bn setTitle:@"岁月" forState:UIControlStateNormal];
    [bn setTitle:@"年轮" forState:UIControlStateHighlighted];
    [bn setTitleColor:[UIColor blackColor]forState:UIControlStateNormal];
    bn.layer.borderWidth = 1;
    bn.layer.cornerRadius = 6;//边框变圆。6为半径.
    bn.layer.borderColor = [UIColor blueColor].CGColor;
    bn.frame = CGRectMake(0, 0, 75, 44);
    bn.center = CGPointMake(self.view.frame.size.width/7, 100);
    [bn addTarget:self action:@selector(onClick:) forControlEvents:UIControlEventTouchDown];
    [bn addTarget:self action:@selector(onClick2:) forControlEvents:UIControlEventTouchDown];
    [self.view addSubview:bn];
    
    UILabel *l = [[UILabel alloc]initWithFrame:CGRectMake(25, 150, 100, 44)];
    l.text = @"雨森";
    [self.view addSubview:l];
    UILabel *sn = [[UILabel alloc]initWithFrame:CGRectMake(25, 390, 100, 44)];
    sn.text = @"木鱼思";
    sn.tag = 100;
    //sn.textAlignment = NSTextAlignmentCenter;//把字居中.
    
    [self.view addSubview:sn];
    
    
    UISwitch *sw = [[UISwitch alloc]initWithFrame:CGRectMake(260, 390, 100, 44)];//开关
    sw.tintColor = [UIColor blackColor];
    [self.view addSubview:sw];
    [sw addTarget:self action:@selector(onSwith:) forControlEvents:UIControlEventValueChanged];

    UISlider *li = [[UISlider alloc]initWithFrame:CGRectMake(220, 150, 100, 44)];
    //li.minimumValueImage = [UIImage imageNamed:@"1"];
    //li.minimumTrackTintColor = [UIColor greenColor];
    //[li maximumValue];
    [self.view addSubview:li];
    
    UIProgressView *gres = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];
    
    
}


- (void)onClick:(UIButton *)sender
{
    sender.backgroundColor = [UIColor whiteColor];
}

- (void)onClick2:(UIButton *)sender
{
    sender.backgroundColor = [UIColor greenColor];
}

- (void)onSwith:(UISwitch *)swi
{
    UILabel *l = (UILabel *)[self.view viewWithTag:100];
    if (swi.isOn)
    {
        l.layer.borderWidth = 1;
    }
    else
    {
        l.layer.borderWidth = 0;
    }
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
